package org.dragonnova.meetingapp.app.fragment.main;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import org.dragonnova.meetingapp.R;
import org.dragonnova.meetingapp.model.bean.MeetingInfo;
import org.dragonnova.meetingapp.model.bean.VoiceInfo;
import org.dragonnova.meetingapp.utils.ContentResolverUtil;
import org.dragonnova.meetingapp.utils.LogUtil;

import java.util.ArrayList;
import java.util.List;


/**
 * A placeholder fragment containing a simple view.
 */
public class MeFragment extends Fragment implements View.OnClickListener {

    private View mContentView;

    public MeFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        mContentView = inflater.inflate(R.layout.content_me, container, false);
        Button button = (Button) mContentView.findViewById(R.id.main_me_bt_meeting);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ContentResolverUtil contentResolverUtil = new ContentResolverUtil(getActivity());
                List<MeetingInfo> list = contentResolverUtil.findAllMeeting();
                LogUtil.eee("meeting list:" + list.toString());
                for (MeetingInfo info : list) {
                    ArrayList<VoiceInfo> voiceInfos = contentResolverUtil.findHistoryById(String.valueOf(info.getSerial()));
                    LogUtil.eee("voicedata list:" + voiceInfos.toString());
                }
            }
        });
        return mContentView;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

    }

    @Override
    public void onClick(View v) {

    }
}
